/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package argtrust.apiexamples;

//import argtrust.argtrustnet.*;
import argtrust.trustnet.*;
import argtrust.logic.*;
import argtrust.argsys.*;

/**
 *
 * @author Yuqing Tang
 */
public class ArgTrustNetExample {

//    void doExample() {
//        ArgTrustNet argtrust = new ArgTrustNet();
//
//        Agent john = new Agent("John");
//        Agent alice = new Agent("Alice");
//        ArgTrustNode node_john = argtrust.addNode(john);
//        ArgTrustNode node_alice = argtrust.addNode(alice);
//
//        node_john.addEdge(alice, new TrustLink(john, alice, 0.8));
//
//
//        Sentence p1 = new Sentence("s1", "watch(movie)");
//        Sentence p2 = new Sentence("s2", "Not watch(movie)");
//        Sentence s3 = new Sentence("s2", "movie is good");
//        Sentence s4 = new Sentence("s2", "movie is bad");
//
//        InferenceRule r1 = new InferenceRule();
//        r1.addPremise(s3);
//        r1.setConclusion(p1);
//
//        ArgTrustEdge edge = node_john.addEdge(s3,
//                new BeliefLink(john, s3, 0.7));
//        ArgTrustNode s3_node = edge.getTail();
//        ReasoningLink r1_reasoning_s3 = new ReasoningLink(r1);
//        r1_reasoning_s3.addPremise(s3);
//        r1_reasoning_s3.setConclusion(p1);
//        ArgTrustEdge p1_node = s3_node.addEdge(r1,
//                r1_reasoning_s3);
//
//        Argument arg = new Argument();
//        arg.addReasoningLink(r1_reasoning_s3);
//
//        //...add more outgoing edges to p1_node....
//
//        //Iterate through the argumentation trust network from john's view
//        ArgTrustIterator my_it = argtrust.iterator(john);
//        //or if you want to go through all the agents:
//        // ArgTrustIterator my_it = argtrust.iterator();
//        //Level by level
//        while (my_it.hasNextLevel()) {
//            ArgTrustIterator level_it = my_it.nextLevel();
//            while (level_it.hasNextAgent()) {
//                Agent agent = level_it.nextAgent();
//                AgentStrFormatter formatter = new AgentStrFormatter();
//                String agent_str = formatter.format(agent);
//            }
//            while (level_it.hasNextArgument()) {
//                Argument argument = level_it.nextArgument();
//                //access the beliefs within an argument
//                ArgLogicIterator logic_it = argument.iterator();
//                while (logic_it.hasNextLevel()) {
//                    while (logic_it.hasNextBelief()) {
//                        Sentence s = (Sentence) logic_it.nextBelief();
//                        //if this is the first level of after an agent
//                        // s is a premises if it is linked from an agent.
//                        // or s is the final conclusion if there is nextLevel in the argument.
//                        if (!level_it.hasNextLevel()) {
//                            // s is a final conclusion.
//                        }
//                        //otherwise s is an intermediate conclusions
//                        //Or
//                        InferenceRule r = (InferenceRule) level_it.nextBelief();
//
//                        LogicStrFormatter formatter = new LogicStrFormatter();
//                        String s_desc = formatter.format(s);
//                        String r_desc = formatter.format(r);
//                    }
//                }
//
//            }
//            while (level_it.hasNextArgDefeat()) {
//                ArgDefeat defeat = level_it.nextArgDefeat();
//            }
//            //access the beliefs directly
//            while (level_it.hasNextBelief()) {
//                Sentence s = (Sentence) level_it.nextBelief();
//                //if this is the first level of after an agent
//                // s is a premises
//                // or
//                if (!level_it.hasNextLevel()) {
//                    // s is a final conclusion.
//                }
//                //otherwise s is an intermediate conclusions
//                //Or
//                InferenceRule r = (InferenceRule) level_it.nextBelief();
//
//            }
//        }
//
//    }
}
